<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/jsp/component/common.jsp" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge" ></meta>
    <title>详细内容</title>
    <link rel="stylesheet" href="${frames}/css/lib/bootstrap.min.css" type="text/css" type="text/css">
    <%@ include file="/WEB-INF/jsp/component/commonBottom.jsp" %>
    <script type="text/javascript" src="../assets/js/echarts.js"></script>
    <link href="../assets/css/bootstrap-datetimepicker.css" type="text/css">
    <script src="../assets/js/bootstrap-datetimepicker.min.js"></script>
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
    <link rel="stylesheet" href="../assets/css/bootstrapDatepickr-1.0.0.css">
    <script src="../assets/js/bootstrapDatepickr-1.0.0.min.js"></script>
    <%--<link rel="stylesheet" href="${frames}/css/lib/dataTables.bootstrap.css" type="text/css">--%>
    <%--<link rel="stylesheet" href="${frames}/css/paginate.css" type="text/css">--%>
    <link rel="stylesheet" href="${newframe}/css/base/base.css" type="text/css">
    <%--<link rel="stylesheet" href="${frames}/css/table.css" type="text/css">--%>
    <%--<link rel="stylesheet" href="${frames}/css/qulitity.css" type="text/css" type="text/css">--%>
    <script src="${frames}/Chronic/laydate/laydate.js"></script>
    <script src="${assets}/js/views/bpAbnormal.js"></script>
    <link rel="stylesheet" href="../assets/css/views/modules/_common.scss">
    <link rel="stylesheet" href="${assets}/css/views/department/departmentMgr.css">
    <style>
        span{
            font:15px/33px 微软雅黑;
            display:inline-block;
        }
        body{
            height:auto;
        }
        h4{
            font:22px/34px 微软雅黑;
            color:black;
        }
        h3{
            font-family: MicrosoftYaHei;
            font-size: 20px;
            font-weight: normal;
            font-stretch: normal;
            letter-spacing: 0px;
            color: #2a3137;
        }
        .title{
            line-height:25px;
            margin-bottom: 5px;
            font-size:16px;
            color:#666666;
            margin-left:10px;
        }
        .title1{
            line-height:25px;
            font-size:16px;
            color:#666666;
            margin-left:10px;
            margin-top:5px;
        }
        .test{
            width:95%;
            overflow:hidden;
            margin-top:15px;
        }
        .test p{
            width:100%;
            line-height:100px;
            font-size:15px;
            text-align:center;
        }
        thead tr th{
            text-align:center;
            width:14.2% !important;
        }
        /*thead hr{*/
        /*border-top: none !important;*/
        /*border-bottom: none !important;*/
        /*}*/
        .dataTable{
            text-align:center;
        }
        .daterange i {
            position: absolute;
            bottom: 10px;
            right: 14px;
            top: auto;
            cursor: pointer;
        }
        .daterange {
            position: relative;
        }
        .container1{
            display:inline-block;
            width:100%;
        }
        .times{
            display:inline-block;
            width:150px;
        }
        .add{
            float: right;
            width: 100px;
            font-size: 16px;
            line-height: 25px;
        }
        .container1{
            margin-top:15px;
        }
        .first_news{
        }
        .pagination{
            float:right !important;
        }
        #tablepart #example tbody tr{
            height:50px;
            margin-bottom:15px;
        }
        #tablepart #example thead tr th{
            color:#999999 !important;
            font:15px/40px '微软雅黑';
            border:none !important;
        }
        .dataTable{
            text-align:center;
        }
        #tablepart #example1 tbody tr td{
            border:none !important;
            font:15px/40px '微软雅黑';
        }
        table.dataTable td, table.dataTable th{
            color:#333333 !important;
            font:15px/40px '微软雅黑';
        }
        #tablepart tr{
            border-bottom:1px solid #d0d0d0;
        }
        .btn{
            background:#35acfd !important;
            margin:0 !important;
            padding:0 !important;
            width: 100px;
            font-size: 16px;
            line-height: 32px;
        }
        #example_wrapper .row:nth-child(3){
            margin-top:20px;
        }
        #tablepart #example tbody tr{
            cursor: pointer;
        }
        #testSelect{
            width: 160px;
            line-height: 33px;
            border-radius: 5px;
            border: solid 1px #d0d0d0;
            display:inline-block;
            float:left;
        }
        img{
            max-width:100%;
            height:auto;
        }
        .bootstrapDatepickr-cal{
            top:160px !important;
        }
        a{
            text-decoration:none;
        }
        .page_nav li{
            list-style:none !important;
        }
        .page_nav li span{
            margin:0 !important;
        }
        .wrap #tablepart{
            margin-top:0px !important;
        }
        thead tr{
            background:#e6e6e6;
        }
        input{
            width:100%;
            line-height: 32px;
            border-radius: 5px;
            border: solid 1px #d0d0d0;
        }
        .dataTables_empty{
            line-height:30px;
        }
    </style>
</head>
<body>
<div>
    <%@ include file="../../breadline.jsp" %>
</div>
<div class="wrap">
    <div id="main" class="content">
        <div style="width:99%;overflow:hidden;background-color: #ffffff;box-shadow: 0px 3px 7px 0px rgba(0, 0, 0, 0.05);">
            <div style="margin-left:19px;width:97%;margin-top:20px;">
                <div class="first_news">
                    <div>
                        <div>
                            <h3 style="display:inline-block;">检测报告</h3>
                        </div>
                        <div class="container1" class="row">
                            <span style="width:94px;display:inline-block;text-align:center;float:left;">检测项目</span>
                            <select class="form-control" id="testSelect" >
                                <option>请选择检验项目</option>
                                <option v-for="item in project" :title="item.testKindCode">{{item.testKindName}}</option>
                            </select>
                            <span style="display:inline-block;text-align:center;float:left;width:71px;"> 时间</span>
                            <div style="display:inline-block;float:left;">
                                <div>
                                    <div class="times">
                                        <div id="PrevTime" class="input-group date form_date" style="width: 100%"  data-date-format="yyyy-mm-dd">
                                            <input id="beginDate" type="text" class="lay-date" placeholder="  开始日期" readonly>
                                        </div>
                                    </div>
                                    <div class="times">
                                        <div id="NextTime" class="input-group date form_date" style="width: 100%" data-date-format="yyyy-mm-dd">
                                            <input id="endDate" type="text" class="lay-date" placeholder="  结束日期" readonly>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <button type="button" class="btn btn-info" onclick="search();" style="margin-left:30px !important;">
                                <img src="../assets/images/search.png" alt="" style="width:18px;vertical-align: middle;"> 搜索
                            </button>
                        </div>
                        <div id="tablepart">
                            <table id="example" class="display" cellspacing="10" width="100%">
                                <thead>
                                <tr>
                                    <th>检验项目</th>
                                    <th>检测时间</th>
                                    <th>数据来源</th>
                                    <th>检测人</th>
                                </tr>
                                </thead>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var vm = new Vue({
        el:"#main",
        data:{
            project:''
        },
        mounted(){
            let that = this;
            var query = window.location.search.substring(1);
            var vars = query.split("=");
            //获取ID
            var url = vars[1].toString()
            $.ajax({
                url:"${URL_PATIENT_SEARCHTESTKIND}",
                dataType:"json",
                type:'post',
                success:function(data){
                    that.project = data.data;
                    console.log(data)
                }
            })
        }
    })
    // boot时间选择器插件
    $(document).ready(function() {
        initLayDate('#beginDate');
        initLayDate('#endDate');
    });
    var table;
    // 获取当前idcard
    var query = window.location.search.substring(1);
    var vars = query.split("=");
    //获取ID
    var url = vars[1].toString()
    var idCard = '${URL_PATIENT_REPORTNEWS}?idCard='+url
    var begintime;
    var endtime;
    var testTime;
    var testKindCode;
    var testKindName;
    var report;
    $.ajax({
        url:idCard,
        dataType:"json",
        type:"post",
        success:function(data){
            report = data.data.list;
        }
    })
    $(function(){
        $('#example tbody').on('click','tr', function () {
            var tr = $(this);
            var index = tr[0].rowIndex;
            testTime = report[index-1].testTime;
            testKindCode = report[index-1].testKindCode;
            testKindName = report[index-1].testKindName;
            parent.showSrc('${URL_PATIENT_RORECARDDETAIL}?idCard=' + url+ "&testTime=" + testTime + "&testKindCode=" + testKindCode + "&testKindName=" + encodeURI(testKindName))
        });
    })
    function search(){
        refreshTable()
    }
    function initTable() {
        table = $('#example').DataTable({
            "dom": "<'row'<'col-xs-2'l><'#mytool.col-xs-10'><'col-xs-6'f>r>" +
            "t" +
            "<'row'<'col-xs-6'i><'col-xs-6'p>>",
            "bFilter": false,//去掉搜索框
            "bAutoWidth": true, //自适应宽度
            "bPaginate": true, //翻页功能
            "bSort": true, //排序功能
            "bAutoWidth": true,//自动宽度
            "info": false,
            "searching" : false, //去掉搜索框方法一
            'lengthChange' : false,
            "oPaginate":false,
            "bServerSide" : true,
            "lengthMenu": [10],
            "sAjaxSource":idCard,
            "sAjaxDataProp": "list",//查询后，返回的集合
            "fnServerData": function ( sSource, aoData, fnCallback ) {  //查询条件
                aoData.push(
                    {
                        "name": "testKindCode",
                        "value": $("#testSelect option:selected").attr('title')
                    },
                    {
                        "name": "beginTime",
                        "value": $('#beginDate').val()
                    },
                    {
                        "name": "endTime",
                        "value": $('#endDate').val()
                    }
                   ),
                    $.ajax({
                        "dataType": 'json',
                        "url": sSource,
                        "type":'post',
                        "data": aoData,
                        "success":function(resp){
                           fnCallback(resp.data)
                        }
                    });
            },
            "aoColumns" : [ {
                "mDataProp" : "testKindName"
            },{
                "targets": 4,
                "data": null,
                "fnCreatedCell": function (nTd, sData, oData, iRow, iCol) {
                    if( oData.testTime != null ){
                        oData.testTime = oData.testTime.slice(0,10)
                    }else{
                        oData.testTime = ""
                    }
                    $(nTd).text(oData.testTime)
                }
            },{
                "mDataProp" : "source"
            },{
                "mDataProp" : "testPerson"
            }],
            "oLanguage": {//插件的汉化
                "sLengthMenu": "32",
                "sZeroRecords" : "抱歉， 没有找到",
                "sInfoEmpty" : "没有数据",
                "sInfoFiltered" : "(从 _MAX_ 条数据中检索)",
                "oPaginate" : {
                    "sFirst" : "",
                    "sPrevious" : "<b>上一页<b>",
                    "sLast" : "",
                    "sNext" : "<i>下一页</i>"

                },
                "sZeroRecords" : "没有检索到数据",
                "sProcessing" : "<img src='' />",
                "sSearch" : "搜索"
            }
        } );
    }
    initTable()
</script>
</body>
</html>